package cn.qh.seasonal.service.impl;

import cn.qh.seasonal.entity.Factoryseasonality;
import cn.qh.seasonal.util.PageUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.qh.seasonal.mapper.FactoryseasonalityMapper;
import cn.qh.seasonal.service.FactoryseasonalityService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Factoryseasonality)表服务实现类
 *
 * @author makejava
 * @since 2021-11-02 08:46:23
 */
@Service("factoryseasonalityService")
public class FactoryseasonalityServiceImpl extends ServiceImpl<FactoryseasonalityMapper, Factoryseasonality> implements FactoryseasonalityService {

    @Resource
    private FactoryseasonalityMapper factoryseasonalityMapper;



    @Override
    public PageUtil<Factoryseasonality> selectFactory(int factoryId, int seasonalId, int currentPage) {
        PageUtil<Factoryseasonality> pageUtil = new PageUtil<>();
        pageUtil.setTotalCount(factoryseasonalityMapper.countFactory(factoryId, seasonalId));
        pageUtil.setPageSize(4);
        pageUtil.setCurrentPage(currentPage);
        List<Factoryseasonality> factoryseasonalities = factoryseasonalityMapper.selectFactory(factoryId, seasonalId, pageUtil.getStartRow(), pageUtil.getPageSize());
        pageUtil.setLists(factoryseasonalities);
        return pageUtil;
    }

    @Override
    public int countFactory(int factoryId, int seasonalId) {
        return factoryseasonalityMapper.countFactory(factoryId, seasonalId);
    }

    @Override
    public Factoryseasonality selectFactoryId(int seasonalId) {
        return factoryseasonalityMapper.selectFactoryId(seasonalId);
    }
}

